package com.handsome.装饰者模式.装饰者类;

import com.handsome.装饰者模式.Drink;

/**
 * @author niechun
 * @date 2023/2/27 20:33
 */
public class Decorator extends Drink {
    private Drink drink;

    public Decorator(Drink drink) {
        this.drink = drink;
    }

    @Override
    public float cost() {
        return super.getPrice()+drink.cost();
    }

    @Override
    public String getDescription() {
        return super.getDescription()+""+super.getPrice()+"&&"+drink.getDescription();
    }
}
